function addSmilie( text, fieldname ) { text = ' ' + text + ' '; if( fieldname.createTextRange && fieldname.caretPos ) { var caretPos = fieldname.caretPos; caretPos.text = caretPos.text.charAt( caretPos.text.length-1 ) == ' ' ? text + ' ' : text; fieldname.focus(); } else { fieldname.value += text; } fieldname.focus(); } var is_tag_open = false; function addTag( tagname, fieldname ) { var theSelection = false; var clientPC = navigator.userAgent.toLowerCase(); // Get client info var clientVer = parseInt(navigator.appVersion); // Get browser version var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1)); var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1)); if ((clientVer >= 4) && is_ie && is_win) theSelection = document.selection.createRange().text; // Get text selection if (theSelection) { document.selection.createRange().text = '[' + tagname + ']' + theSelection + '[/' + tagname + ']'; fieldname.focus(); theSelection = ''; return; } else { if( !is_tag_open ) { fieldname.value += '[' + tagname + ']'; is_tag_open = true; } else { fieldname.value += '[/' + tagname + ']'; is_tag_open = false; } fieldname.focus(); } } function addLink( fieldname ) { linkCaption = prompt( "Enter a caption for the link (optional)", "" ); linkURL = prompt( "Enter the URL of the link", "http://" ); if( linkURL!=null && linkURL!="" ) { if( linkCaption!=null && linkCaption!="" ) fieldname.value += ' [url=' + linkURL + ']' + linkCaption + '[/url] '; else fieldname.value += ' [url]' + linkURL + '[/url] '; } fieldname.focus(); } function addWikiLink( fieldname ) { wikiPage = prompt( "Enter the title of the page", "" ); wikiCaption = prompt( "Enter a caption for the link", wikiPage ); if( wikiPage!=null && wikiPage!="" ) { if( wikiCaption!=null && wikiCaption!="" && wikiPage!=wikiCaption ) fieldname.value += ' [wiki=' + wikiPage + ']' + wikiCaption + '[/wiki] '; else fieldname.value += ' [wiki]' + wikiPage + '[/wiki] '; } fieldname.focus(); } function addImage( fieldname ) { imageURL = prompt( "Enter the URL of the image (must be remotely stored)", "http://" ); if( imageURL!=null && imageURL!="" ) { fieldname.value += ' [img]' + imageURL + '[/img] '; } fieldname.focus(); } function addList( fieldname ) { listOptions = ""; do { listEntry = prompt( "Enter an entry of the list\n(Leave blank or click cancel to stop)", "" ); if( listEntry!="" && listEntry!=null ) { listOptions += "[*] " + listEntry + "\n"; } } while( listEntry!="" && listEntry!=null ); if( listOptions!="" ) { fieldname.value += "[list]\n" + listOptions + "[/list]\n"; } fieldname.focus(); } function goToPage( url ) { window.location = url; } function showPopup( url ) { window.open( url, "popup", "toolbar=no,scrollbars=no,resizable=yes,width=20,height=20" ); } function getElement( name ) { if( document.all ) { return document.all[name]; } else { return document.getElementById(name); } }